/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package au.csiro.nt.psdp.actions.ims;

/**
 *
 * @author Administrator
 */
import au.csiro.nt.psdp.actions.PdspActionSupport;
import au.csiro.nt.psdp.manager.ImsManager;
import au.csiro.nt.psdp.model.Ims;
public class ViewImsAction extends PdspActionSupport{
    private ImsManager imsManager;
    private Ims ims;
    private String imsid;

    /**
     * @return the imsManager
     */
    public ImsManager getImsManager() {
        return imsManager;
    }

    /**
     * @param imsManager the imsManager to set
     */
    public void setImsManager(ImsManager imsManager) {
        this.imsManager = imsManager;
    }

    /**
     * @return the ims
     */
    public Ims getIms() {
        return imsManager.getIms(Integer.parseInt(imsid));
    }

    /**
     * @param ims the ims to set
     */
    public void setIms(Ims ims) {
        this.ims = ims;
    }

    /**
     * @return the imsid
     */
    public String getImsid() {
        return imsid;
    }

    /**
     * @param imsid the imsid to set
     */
    public void setImsid(String imsid) {
        this.imsid = imsid;
    }
    public String execute()
    {
        System.out.println("in execute function");
        return SUCCESS;
    }
    public String disagree() throws Exception
    {
        Ims aims = this.getIms();
        aims.setRecvmessage("No");
        aims.setRecvtime(new java.util.Date());
        imsManager.saveIms(aims);
        //set id for redirect usage
       
        System.out.println("In Delete function");
        return SUCCESS;
    }
    public String cancel()
    {
        System.out.println("In Cancel function");
        return "cancel";
    }

    public String agree() throws Exception
    {
        Ims aims = this.getIms();
        aims.setRecvmessage("Yes");
        aims.setRecvtime(new java.util.Date());
        imsManager.saveIms(aims);

        //set id for redirect usage
       

        System.out.println("In Save function");
        return SUCCESS;
    }
}
